var ReportDetail = function () {
  var template = /* html */ `
    <div class="report-detail">
      <el-form label-width="auto" size="mini">
        <el-form-item label="系统编号">
          <span>{{report.orderId}}</span>
        </el-form-item>
        <el-form-item label="订单编号">
          <span>{{report.companyOrderId}}</span>
        </el-form-item>
        <el-form-item label="工厂型号">
          <span>{{report.factoryId}}</span>
        </el-form-item>
        <el-form-item label="客户型号">
          <span>{{report.customerId}}</span>
        </el-form-item>
        <el-form-item label="工序">
          <span>{{report.processName}}</span>
        </el-form-item>
        <el-form-item label="质检类型">
          <span>{{i18n.getMsg('productMgr.qcReport.type.'+report.type)}}</span>
        </el-form-item>
        <el-form-item label="图片">
          <el-image class="detail-img" v-if="report.img" :src="formatImgUrl(report.img)" fit="scale-down"
            :preview-src-list="[formatImgUrl(report.img)]">
          </el-image>
        </el-form-item>
        <el-form-item label="质检人" v-if="type==='approval'">
          <span>{{report.createUser}}</span>
        </el-form-item>
        <el-form-item label="质检时间">
          <span>{{moment(report.createTime).format('YYYY-MM-DD')}}</span>
        </el-form-item>
        <el-form-item label="审核状态">
          <span>{{i18n.getMsg('productMgr.qcReport.status.'+report.status)}}</span>
        </el-form-item>
        <el-form-item label="可审核人" v-if="report.status===0">
          <span>{{report.canApprovalNameList.join(',')}}</span>
        </el-form-item>
        <el-form-item label="备注">
          <div v-html="getTextHtml(report.remark)" style="line-height:16px;padding-top:6px"></div>
        </el-form-item>
      </el-form>
      <div class="report-detail-qc" v-for="(detail,index) in report.detailList" :key="'detail_'+index">
        <div class="report-detail-title">质检内容第{{index+1}}行</div>
        <el-form label-width="auto" size="mini">
          <el-form-item label="内容">
            <span>{{report.content}}</span>
          </el-form-item>
          <el-form-item label="默认值">
            <span>{{report.reportValue}}</span>
          </el-form-item>
          <el-form-item label="结果">
            <span>{{i18n.getMsg('productMgr.qcReport.result.'+report.result)}}</span>
          </el-form-item>
        </el-form>
      </div>
    </div>
  `;

  return {
    props: {
      report: {
        type: Object,
        required: true
      },
      type: {
        type: String,
        default: 'approval'
      }
    },

    data: function () {
      return {
        i18n: i18n,
        moment: moment
      };
    },

    methods: {
      getTextHtml: function (text) {
        if (SysUtil.isEmpty(text)) {
          return '';
        }
        var htmlText = _.escape(text);
        htmlText = htmlText.replace(/ /g, '&nbsp;').replace(/\n/g, '<br>');
        return htmlText;
      }
    },

    template: template
  };
}();
